<template>
  <div>

    <van-address-list
      v-model="chosenAddressId"
      :list="addressarr"
      :disabled-list="disabledList"
      disabled-text="以下地址超出配送范围"
      default-tag-text="默认"
      @add="onAdd"
      @edit="onEdit"
    />
   

  </div>
</template>

<script>
import { mapState } from "vuex";
import { Toast } from 'vant';
export default {
  data() {
    return {
      chosenAddressId: "1",
      list: [],
      disabledList: [
        // 禁止配送的区域
        {
          id: "3",
          name: "王五",
          tel: "1320000000",
          address: "浙江省杭州市滨江区江南大道 15 号",
        },
      ],
    };
  },
  methods: {
    onAdd() {
       this.$router.push(
           {
               path:"/addaddress",
               query:{
                   isadd:"新增"
               }
           }
       )
    },
    onEdit(item, index) {
     console.log(item);
     let obj = Object.assign({},item,{index:index},{isadd:"编辑"})
     this.$router.push(
         {
             path:"/addaddress",
             query:obj
         }
      )
    //   Toast("编辑地址:" + index);
    },
  },
  computed: {
    ...mapState(["addressarr"]),
  },
};
</script>

<style>
</style>